<!DOCTYPE html>
<html lang="en">
<head>
<title>WebView4Delphi: uWVTypeLibrary: Interface ICoreWebView2ControllerOptions2</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="PasDoc 0.16.0-snapshot">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<span id="ICoreWebView2ControllerOptions2"></span><h1 class="cio">Interface ICoreWebView2ControllerOptions2</h1>
<div class="sections">
<div class="one_section"><a class="section" href="#PasDoc-Description">Description</a></div><div class="one_section"><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></div><div class="one_section">Fields</div><div class="one_section"><a class="section" href="#PasDoc-Methods">Methods</a></div><div class="one_section">Properties</div></div>
<span id="PasDoc-Description"></span><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="uWVTypeLibrary.html">uWVTypeLibrary</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type ICoreWebView2ControllerOptions2 = interface(<a class="normal" href="uWVTypeLibrary.ICoreWebView2ControllerOptions.html">ICoreWebView2ControllerOptions</a>)</code></p>
<h2 class="description">Description</h2>
<p>
 This is the interface in ControllerOptions for ScriptLocale. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controlleroptions2">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controlleroptions2</a>&quot;&gt;See the ICoreWebView2ControllerOptions2 article.)</p>
<span id="PasDoc-Hierarchy"></span><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">IUnknown</li>
<li class="ancestor"><a class="normal" href="uWVTypeLibrary.ICoreWebView2ControllerOptions.html">ICoreWebView2ControllerOptions</a></li>
<li class="thisitem">ICoreWebView2ControllerOptions2</li></ul><h2 class="overview">Overview</h2>
<span id="PasDoc-Methods"></span><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2ControllerOptions2.html#Get_ScriptLocale-PWideChar-">Get_ScriptLocale</a></strong>(out locale: PWideChar): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2ControllerOptions2.html#Set_ScriptLocale-PWideChar-">Set_ScriptLocale</a></strong>(locale: PWideChar): HResult; stdcall;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_ScriptLocale-PWideChar-"></span><code>function <strong>Get_ScriptLocale</strong>(out locale: PWideChar): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The default locale for the WebView2. It sets the default locale for all Intl JavaScript APIs and other JavaScript APIs that depend on it, namely `Intl.DateTimeFormat()` which affects string formatting like in the time/date formats. Example: `Intl.DateTimeFormat().format(new Date())` The intended locale value is in the format of BCP 47 Language Tags. More information can be found from [IETF BCP47](<a href="https://www.ietf.org/rfc/bcp/bcp47.html">https://www.ietf.org/rfc/bcp/bcp47.html</a>).

<p>This property sets the locale for a CoreWebView2Environment used to create the WebView2ControllerOptions object, which is passed as a parameter in `CreateCoreWebView2ControllerWithOptions`.

<p>Changes to the ScriptLocale property apply to renderer processes created after the change. Any existing renderer processes will continue to use the previous ScriptLocale value. To ensure changes are applied to all renderer process, close and restart the CoreWebView2Environment and all associated WebView2 objects.

<p>The default value for ScriptLocale will depend on the WebView2 language and OS region. If the language portions of the WebView2 language and OS region match, then it will use the OS region. Otherwise, it will use the WebView2 language.

<p>| OS Region | WebView2 Language | Default WebView2 ScriptLocale | |&mdash;&mdash;&mdash;&ndash;|&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-|&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-| | en-GB | en-US | en-GB | | es-MX | en-US | en-US | | en-US | en-GB | en-US |

<p>You can set the ScriptLocale to the empty string to get the default ScriptLocale value.

<p>Use OS specific APIs to determine the OS region to use with this property if you want to match the OS. For example:

<p>Win32 C++: ```cpp wchar_t osLocale[LOCALE_NAME_MAX_LENGTH] = {0}; GetUserDefaultLocaleName(osLocale, LOCALE_NAME_MAX_LENGTH); ```

<p>The caller must free the returned string with `CoTaskMemFree`. See [API Conventions](/microsoft-edge/webview2/concepts/win32-api-conventions#strings). \snippet AppWindow.cpp ScriptLocaleSetting </p>
<h6 class="description_section">Attributes</h6>
<dl class="attributes">
  <dt>GUID['{06C991D8-9E7E-11ED-A8FC-0242AC120002}']</dt>
  <dd></dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Set_ScriptLocale-PWideChar-"></span><code>function <strong>Set_ScriptLocale</strong>(locale: PWideChar): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Sets the `ScriptLocale` property. </p>
</td></tr>
</table>
<hr><span class="appinfo"><em>Generated by <a href="https://pasdoc.github.io/">PasDoc 0.16.0-snapshot</a>. </em>
</span>
</body></html>
